<template>
	<div class="zco-business-message-container">
		<ScreenSharing
			v-if="businessType === 'screen-share' || businessType === 'stop-screen-share'"
			:businessType="businessType"
			:toUserRole="message.toUserInfo.role"
			:toUserName="message.toUserInfo.userName"
		/>
		<ScreenMark v-if="message.data.cmd === 'screen-mark'" :businessType="businessType" />
		<GetGeoLocation v-if="message.data.cmd === 'get-geo-location'" :message="message" :businessType="businessType" />
		<GetScreenShot v-if="message.data.cmd === 'get-screenshot'" :message="message" :businessType="businessType" />
		<GetScreenCapture v-if="message.data.cmd === 'get-screencapture'" :message="message" :businessType="businessType" />
		<FaceIdCardValidate
			v-if="message.data.cmd === 'face-idcard-validate' || (businessType === 'ai-checkout' && message.data.status === 'match-idCard-face')"
			:imageUrl="
				message && message.data && message.data.data && message.data.data.imageUrl
					? message.data.data.imageUrl
					: message.data.request && message.data.request.capturedImg && message.data.request.capturedImg.url
					? message.data.request.capturedImg.url
					: ''
			"
			:result="message && message.data && message.data.data && message.data.data.result ? message.data.data.result : message.data.response"
			:toUserName="message && message.toUserInfo && message.toUserInfo.userName ? message.toUserInfo.userName : message.data.customerClient.user.name"
			:toUserRole="message && message.toUserInfo && message.toUserInfo.role ? message.toUserInfo.role : message.data.customerClient.role"
			:fromUserName="message.fromUser.name"
		/>
		<FaceRecognition
			v-if="message.data.cmd === 'face-recognition' || (businessType === 'ai-checkout' && message.data.status === 'compare-face')"
			:imageUrl="
				message && message.data && message.data.data && message.data.data.imageUrl
					? message.data.data.imageUrl
					: message.data.request && message.data.request.capturedImg && message.data.request.capturedImg.url
					? message.data.request.capturedImg.url
					: ''
			"
			:result="message && message.data && message.data.data && message.data.data.result ? message.data.data.result : message.data.response"
			:toUserName="message && message.toUserInfo && message.toUserInfo.userName ? message.toUserInfo.userName : message.data.customerClient.user.name"
			:toUserRole="message && message.toUserInfo && message.toUserInfo.role ? message.toUserInfo.role : message.data.customerClient.role"
			:fromUserName="message.fromUser.name"
		/>
		<CoBrowsing v-if="message.data.cmd === 'co-browsing' && message.data.data.type === 'request-pages'" :toUserName="message.toUserInfo.userName" :toUserRole="message.toUserInfo.role" />
		<WhiteBoard v-if="message.data.cmd === 'whiteboard'" :businessType="businessType" :toUserRole="message.toUserInfo.role" :toUserName="message.toUserInfo.userName" />
		<WhiteBoardPdf
			v-if="message.data.cmd === 'whiteboard-pdf'"
			:businessType="businessType"
			:toUserRole="message.toUserInfo.role"
			:toUserName="message.toUserInfo.userName"
			:fromUserName="message.fromUser.name"
			:fileName="message && message.data && message.data.data && message.data.data.data && message.data.data.data.name ? message.data.data.data.name : ''"
			:fileUrl="message && message.data && message.data.data && message.data.data.data && message.data.data.data.url ? message.data.data.data.url : ''"
		/>
		<RegionalScreenRecording v-if="['start-recording', 'stop-recording', 'system-start-recording', 'system-stop-recording'].includes(businessType)" :businessType="businessType" />
		<ScreenRecord v-if="businessType === 'screen-record' || businessType === 'stop-screen-record'" :businessType="businessType" />
		<ScanCode v-if="message.data.cmd === 'scan-code'" :message="message" :businessType="businessType" />
		<FillForm v-if="message.data.cmd === 'fill-form'" :message="message" :businessType="businessType" />
		<GetHandWriting v-if="message.data.cmd === 'get-handwriting'" :message="message" :businessType="businessType" :fromUserName="message.fromUser.name" />
		<TestimonyWrite v-if="message.data.cmd === 'testimony-write'" :message="message" :businessType="businessType" :fromUserName="message.fromUser.name" />
		<CollectShortVideo v-if="message.data.cmd === 'collect-short-video'" :message="message" :businessType="businessType" />
		<CollectVariable v-if="message.data.cmd === 'collect-variable'" :message="message" :businessType="businessType" />
		<CardCollection v-if="message.data.cmd === 'idcard-collection' || message.data.cmd === 'bankcard-collection'" :message="message" :businessType="businessType" />
		<OCR v-if="businessType === 'ocr'" :businessType="message.data.type" :message="message" />
		<TTS
			v-if="businessType === 'start-tts-speaking' || businessType === 'cancel-tts-speaking'"
			:businessType="businessType"
			:data="message && message.data ? message.data : ''"
			:fromUserName="message.fromUser.name"
		/>
		<NoResponse v-if="message.data.cmd === 'view'" :businessType="businessType" :fromUserName="message.fromUser.name" :message="message" />
		<Transfer
			v-if="businessType === 'invite' && message && message.data && message.data.type !== 'invite-multiple' && message.data.type !== 'invite-multiple-human'"
			:agentId="message && message.data && message.data.agentId ? message.data.agentId : ''"
			:bizSceneName="message && message.data && message.data.bizSceneName ? message.data.bizSceneName : ''"
			:failReason="message && message.invitation && message.invitation.failReason ? message.invitation.failReason : ''"
		/>
		<Invite
			v-if="businessType === 'invite' && message && message.data && (message.data.type === 'invite-multiple' || message.data.type === 'invite-multiple-human')"
			:agentId="message && message.data && message.data.agentId ? message.data.agentId : ''"
			:bizSceneName="message && message.data && message.data.bizSceneName ? message.data.bizSceneName : ''"
			:failReason="message && message.invitation && message.invitation.failReason ? message.invitation.failReason : ''"
		/>
		<RequestUpgrade
			v-if="businessType === 'request-upgrade' || businessType === 'cancel-upgrade' || businessType === 'accept-upgrade' || businessType === 'reject-upgrade'"
			:businessType="businessType"
			:message="message"
		/>
		<p v-if="businessType === 'invite-customer' && message.data.role === 'customer' && message.data.status === 'joined'">邀请访客&lt;{{ message.data.user.name }}&gt;加入会话</p>
		<CustomerViewMark v-if="message.data.cmd === 'customer-view-mark'" :message="message" :businessType="businessType" />
	</div>
</template>
<script>
import ScreenSharing from './ScreenSharing/index.vue';
import ScreenMark from './ScreenMark/index.vue';
import GetGeoLocation from './GetGeoLocation/index.vue';
import GetScreenShot from './GetScreenShot/index.vue';
import GetScreenCapture from './GetScreenCapture/index.vue';
import FaceIdCardValidate from './FaceIdCardValidate/index.vue';
import FaceRecognition from './FaceRecognition/index.vue';
import CoBrowsing from './CoBrowsing/index.vue';
import WhiteBoard from './WhiteBoard/index.vue';
import WhiteBoardPdf from './WhiteBoardPdf/index.vue';
import ScreenRecord from './ScreenRecord/index.vue';
import ScanCode from './ScanCode/index.vue';
import FillForm from './FillForm/index.vue';
import GetHandWriting from './GetHandWriting/index.vue';
import TestimonyWrite from './TestimonyWrite/index.vue';
import CollectShortVideo from './CollectShortVideo/index.vue';
import CollectVariable from './CollectVariable/index.vue';
import CardCollection from './CardCollection/index.vue';
import OCR from './OCR/index.vue';
import TTS from './TTS/index.vue';
import NoResponse from './View/index.vue';
import Transfer from './Transfer/index.vue';
import Invite from './Invite/index.vue';
import RegionalScreenRecording from './RegionalScreenRecording/index.vue';
import RequestUpgrade from './RequestUpgrade/index.vue';
import CustomerViewMark from './CustomerViewMark/index.vue';

export default {
	name: 'App',
	components: {
		ScreenSharing,
		ScreenMark,
		GetGeoLocation,
		GetScreenShot,
		GetScreenCapture,
		FaceIdCardValidate,
		FaceRecognition,
		CoBrowsing,
		WhiteBoard,
		WhiteBoardPdf,
		ScreenRecord,
		ScanCode,
		FillForm,
		GetHandWriting,
		TestimonyWrite,
		CollectShortVideo,
		CollectVariable,
		CardCollection,
		OCR,
		TTS,
		NoResponse,
		Transfer,
		Invite,
		RegionalScreenRecording,
		RequestUpgrade,
		CustomerViewMark
	},
	props: {
		businessType: {
			type: String,
			default: () => ''
		},
		message: {}
	},
	data() {
		return {};
	},
	methods: {},
	created() {},
	mounted() {}
};
</script>
<style scoped>
.zco-business-message-container {
	background: #ffffff;
	border-radius: 4px;
	border: 1px solid #e1e2e5;
	font-size: 12px;
	font-weight: 400;
	padding: 8px 12px;
	margin: 0;
	max-width: 240px;
	overflow: hidden;
	word-break: break-word;
	color: #1b1b1b;
}
.zco-business-message-container p {
	margin: 0;
}
</style>
